<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%--  获取Cookie，保存在用户和密码框中 --%>
    <%
        String username = "";
        String password = "";
        Cookie[] cookies = request.getCookies();
        if(cookies != null && cookies.length > 0){
          for(Cookie cookie : cookies){
             if(cookie.getName().equals("username")){
                username = cookie.getValue();
             }
             if(cookie.getName().equals("password")){
                password = cookie.getValue();
             }
          }
        }
     %>

    <form method="post" action="servlet/back/ServletBack?opr=user">
      <table>
         <tr>
             <td>用户名：</td>
             <td><input name="username" type="text" value="<%=username %>" /><td/>
         </tr>
         
         <tr>
             <td>密码：</td>
             <td><input name="password" type="password"  value="<%=password%>" /><td/>
         </tr>
         
         <tr>
             <td><input name="submit" type="submit" value="登    录" /><td/>
         </tr>
       </table>
    </form>
  </body>
</html>
